<template>
          <div class="layerRtb layerRtb-threecolumn layerRtb-right">
            <three-title :title="{name:'处理历史'}" :close="false">
                <span tag="i" class="rig_close fr" @click="$parent.$parent.clickFourShow()"></span>
            </three-title>
        <div class="mb10 fr mr10">
            <span class="mr10">选择日期</span>
                <el-date-picker v-model="dateValue" type="date" format="yyyy/MM" placeholder="选择日期" @change="dataChange"></el-date-picker>
        </div>
        <div class="layerRtb-scroll thinScroll"  v-if="handlerIntegral.length>0" v-scrollHeight="90">
            <div class="analyItem"  v-for="(item,index) in handlerIntegral" :key="index">
                <p class="analyItemTit tx-center">处理-{{index+1}}</p>
                <div class="analyItemCon">
                    <p class="col-md-3">时间：
                        <span class="cLightGray pr8">{{item.CreateTime}}</span>
                    </p>
                    <p class="col-md-3">内容：
                        <span class="cLightGray pr8">{{item.TaskContent}}</span>
                    </p>
                    <p class="col-md-3">积分：
                        <span class="cLightGray pr8">{{item.TaskIntegral}}</span>
                    </p>
                </div>
            </div>
        </div>
        <div class="layerRtb-scroll thinScroll" v-scrollHeight="0" v-else>
                <div class="analyItem">
                    <p class="analyItemTit tx-center">处理</p>
                    <div class="analyItemCon">
                        <p class="col-md-12">
                            <span>暂无内容！</span>
                        </p>
                    </div>
                </div>
        </div>
         <div class="layerRtb-footer">
             <div class="analyItem">
               <p class="analyItemTit tx-center">综合</p>
                   <div class="analyItemCon">
                        <p class="col-md-12">
                            <span>积分-</span>
                            <span>{{compluedTask}}</span>
                        </p>
                    </div>
            </div>
        </div>
    </div>
</template>
<script>
import { mapGetters } from 'vuex'
import { personHandlerIntegralHistory } from '../../../Resources/Api/index'
export default {
    data () {
        return {
            handlerIntegral: [],
            dateValue: ''
        }
    },
    created () {
        this.GetDeposit()
    },
    methods: {
        GetDeposit () {
            let _this = this
            _this.handlerIntegral = []
            personHandlerIntegralHistory({
                createUserNo: _this.leftInfo.app_cardNo,
                cuurentMonth: this.$utils.format('yyyy-MM', this.dateValue)
            }).then(results => {
                _this.handlerIntegral = results.data.Body
            }).catch(error => {
                console.log(error)
            })
        },
        dataChange () {
            this.GetDeposit()
        }
    },
    computed: {
        ...mapGetters(['leftInfo']),
        compluedTask () {
            return this.handlerIntegral.map(item => item.TaskIntegral).reduce((acc, cur) => (cur + acc), 0)
        }
    },
    watch: {
        leftInfo () {
            this.GetDeposit()
        }
    }
}
</script>
